#ifndef BATTLE_H
#define BATTLE_H

#include <QWidget>
#include <QPushButton>
#include "pokemon.h"

namespace Ui { class battle; }

namespace Ui {
class battle;
}

class battle : public QWidget
{
    Q_OBJECT

public:
    explicit battle(QWidget *parent = nullptr);
    ~battle();
    void setPlayerPokemon(Pokemon* pokemon);
    void setEnemyPokemon(Pokemon* pokemon);
    void startBattle();
signals:
    void back();//定义一个用来返回的信号


private slots:
    void on_runButton_clicked();
    void on_skillButton1_clicked();
    void on_skillButton2_clicked();
    void on_skillButton3_clicked();
    void on_skillButton4_clicked();
   void onSkillUsed(int index, Pokemon* user);
    void onFainted();

private:
    Ui::battle *ui;
    Pokemon* m_playerPokemon;
    Pokemon* m_enemyPokemon;
    bool m_isPlayerTurn;

    void updateUI();
    void enemyTurn();
    void checkBattleEnd();
};

#endif // BATTLE_H
